home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / text / manipulation / snap164.lha / openclose.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-30  |  15.0 KB  |  590 lines

  1. /* Auto: make "CCEXTRA=-wq -qf"
  2. */
  3.  
  4. #if __SASC
  5. #include "snap.h"
  6. #endif
  7.  
  8. IMPORT BOOL Kick36;
  9.  
  10. IMPORT LONGBITS startsignal, insertsignal, cancelsignal;
  11. IMPORT LONGBITS donesignal, movesignal, clicksignal;
  12. IMPORT LONGBITS timersignal, initsignal, cwsignal, ticksignal;
  13. IMPORT ULONG startsignum, insertsignum, cancelsignum;
  14. IMPORT ULONG donesignum, movesignum, clicksignum;
  15. IMPORT ULONG initsignum, cwsignum, ticksignum;
  16.  
  17. /* program */
  18. IMPORT struct SnapRsrc *SnapRsrc;
  19. IMPORT struct Task *MyTask;
  20.  
  21. /* Snap state machine */
  22. IMPORT WORD action;
  23. IMPORT WORD state;
  24.  
  25. /* clipboard */
  26. IMPORT struct IOClipReq *ClipReq;
  27. IMPORT struct MsgPort *ClipPort;
  28.  
  29. /* timer device */
  30. IMPORT struct MsgPort *TimerPort;
  31. IMPORT struct timerequest MyTR;
  32.  
  33. /* input device */
  34. IMPORT struct MsgPort *inputDevPort;
  35. IMPORT struct Interrupt handlerStuff;
  36. IMPORT struct IOStdReq *inputRequestBlock;
  37.  
  38. IMPORT UBYTE *CharData;
  39.  
  40. /* console */
  41. IMPORT struct MsgPort *ConPort;
  42. IMPORT struct IOStdReq *ConIOR;
  43. IMPORT struct KeyMap keymap;
  44.  
  45. /* windows */
  46. #ifdef SNAPGFX
  47. IMPORT struct MsgPort *Sharedport;
  48. IMPORT SHORT Sharedrefs;
  49. #endif SNAPGFX
  50.  
  51. /* libraries */
  52. IMPORT struct IntuitionBase *IntuitionBase;
  53. IMPORT struct GfxBase       *GfxBase;
  54. #if 0
  55. IMPORT struct LayersBase    *LayersBase;
  56. IMPORT struct DiskFontBase  *DiskfontBase;
  57. #endif
  58. IMPORT struct Library *    LayersBase;
  59. IMPORT struct Library *    DiskfontBase;
  60.  
  61. IMPORT struct Library       *IconBase;
  62. #ifdef SNAPGFX
  63. #ifdef REQLIB
  64. IMPORT struct ReqBase       *ReqBase;
  65. #endif REQLIB
  66. #ifdef ASLLIB
  67. IMPORT struct Library *AslBase;
  68. #endif ASLLIB
  69. #endif SNAPGFX
  70.  
  71. /* graphics */
  72. IMPORT struct RastPort TempRp;
  73. IMPORT struct BitMap TempBM;
  74. IMPORT UBYTE *TempRaster;
  75.  
  76. #ifdef SNAPGFX
  77. #ifdef REQLIB
  78. IMPORT struct ReqFileRequester *NameFR;
  79. #endif REQLIB
  80. #ifdef ASLLIB
  81. #define SetTag(t,i,v) { (t).ti_Tag = i; (t).ti_Data = (ULONG)(v); }
  82. IMPORT struct FileRequester *AslNameFR;
  83. #endif ASLLIB
  84.  
  85. IMPORT struct Image ActiveDiskImage;
  86. IMPORT struct Image InactiveDiskImage;
  87. IMPORT struct Image SelDiskImage;
  88. IMPORT struct Image ActiveClipImage;
  89. IMPORT struct Image InactiveClipImage;
  90. IMPORT struct Image SelClipImage;
  91. IMPORT struct Gadget DiskGad;
  92. IMPORT struct Gadget ClipGad;
  93.  
  94. UWORD DiskImData36[144] = {
  95.     /* Inactive */
  96.     0x0000, 0x0000,
  97.     0x0000, 0x4000,
  98.     0x07f8, 0x4000,
  99.     0x0408, 0x4000,
  100.     0x05E8, 0x4000,
  101.     0x0408, 0x4000,
  102.     0x07F8, 0x4000,
  103.     0x0618, 0x4000,
  104.     0x0698, 0x4000,
  105.     0x0698, 0x4000,
  106.     0x0000, 0x4000,
  107.     0x7FFF, 0xC000,
  108.  
  109.     0xFFFF, 0xC000,
  110.     0x8000, 0x0000,
  111.     0x8000, 0x0000,
  112.     0x8000, 0x0000,
  113.     0x8000, 0x0000,
  114.     0x8000, 0x0000,
  115.     0x8000, 0x0000,
  116.     0x8000, 0x0000,
  117.     0x8000, 0x0000,
  118.     0x8000, 0x0000,
  119.     0x8000, 0x0000,
  120.     0x8000, 0x0000,
  121.  
  122.     /* Active */
  123.     0x0000, 0x0000,
  124.     0x7FFF, 0xC000,
  125.     0x7FFF, 0xC000,
  126.     0x7C0F, 0xC000,
  127.     0x7DEF, 0xC000,
  128.     0x7C0F, 0xC000,
  129.     0x7FFF, 0xC000,
  130.     0x7E1F, 0xC000,
  131.     0x7E9F, 0xC000,
  132.     0x7E9F, 0xC000,
  133.     0x7FFF, 0xC000,
  134.     0x7FFF, 0xC000,
  135.  
  136.     0xFFFF, 0xC000,
  137.     0xFFFF, 0x8000,
  138.     0xF807, 0x8000,
  139.     0xFBF7, 0x8000,
  140.     0xFA17, 0x8000,
  141.     0xFBF7, 0x8000,
  142.     0xF807, 0x8000,
  143.     0xF9E7, 0x8000,
  144.     0xF967, 0x8000,
  145.     0xF967, 0x8000,
  146.     0xFFFF, 0x8000,
  147.     0x8000, 0x0000,
  148.  
  149.     /* Selected */
  150.     0xFFFF, 0xC000,
  151.     0xFFFF, 0x8000,
  152.     0xFFFF, 0x8000,
  153.     0xFC0F, 0x8000,
  154.     0xFDEF, 0x8000,
  155.     0xFC0F, 0x8000,
  156.     0xFFFF, 0x8000,
  157.     0xFE1F, 0x8000,
  158.     0xFE9F, 0x8000,
  159.     0xFE9F, 0x8000,
  160.     0xFFFF, 0x8000,
  161.     0x8000, 0x0000,
  162.  
  163.     0x0000, 0x0000,
  164.     0x7FFF, 0xC000,
  165.     0x7807, 0xC000,
  166.     0x7BF7, 0xC000,
  167.     0x7A17, 0xC000,
  168.     0x7BF7, 0xC000,
  169.     0x7807, 0xC000,
  170.     0x79E7, 0xC000,
  171.     0x7967, 0xC000,
  172.     0x7967, 0xC000,
  173.     0x7FFF, 0xC000,
  174.     0x7FFF, 0xC000
  175. };
  176.  
  177. UWORD DiskImData[13] = {
  178.     /* BitPlane 0 */
  179.     0xFFFF,
  180.     0xFFFF,
  181.     0xFFFF,
  182.     0xF00F,
  183.     0xF7EF,
  184.     0xF42F,
  185.     0xF7EF,
  186.     0xF00F,
  187.     0xF3CF,
  188.     0xF2CF,
  189.     0xF2CF,
  190.     0xFFFF,
  191.     0xFFFF
  192. };
  193.  
  194. UWORD ClipImData36[156] = {
  195.     /* Inactive */
  196.     0x0000, 0x0000,
  197.     0x0000, 0x4000,
  198.     0x0C00, 0x4000,
  199.     0x120E, 0x4000,
  200.     0x1A38, 0x4000,
  201.     0x0EE0, 0x4000,
  202.     0x0380, 0x4000,
  203.     0x0EE0, 0x4000,
  204.     0x1A38, 0x4000,
  205.     0x120E, 0x4000,
  206.     0x0C00, 0x4000,
  207.     0x0000, 0x4000,
  208.     0x7FFF, 0xC000,
  209.  
  210.     0xFFFF, 0xC000,
  211.     0x8000, 0x0000,
  212.     0x8000, 0x0000,
  213.     0x8000, 0x0000,
  214.     0x8000, 0x0000,
  215.     0x8000, 0x0000,
  216.     0x8000, 0x0000,
  217.     0x8000, 0x0000,
  218.     0x8000, 0x0000,
  219.     0x8000, 0x0000,
  220.     0x8000, 0x0000,
  221.     0x8000, 0x0000,
  222.     0x8000, 0x0000,
  223.  
  224.     /* Active */
  225.     0x0000, 0x0000,
  226.     0x7FFF, 0xC000,
  227.     0x7FFF, 0xC000,
  228.     0x7FFF, 0xC000,
  229.     0x7FFF, 0xC000,
  230.     0x7FFF, 0xC000,
  231.     0x7FFF, 0xC000,
  232.     0x7FFF, 0xC000,
  233.     0x7FFF, 0xC000,
  234.     0x7FFF, 0xC000,
  235.     0x7FFF, 0xC000,
  236.     0x7FFF, 0xC000,
  237.     0x7FFF, 0xC000,
  238.  
  239.     0xFFFF, 0xC000,
  240.     0xFFFF, 0x8000,
  241.     0xF3FF, 0x8000,
  242.     0xEDF1, 0x8000,
  243.     0xE5C7, 0x8000,
  244.     0xF11F, 0x8000,
  245.     0xFC7F, 0x8000,
  246.     0xF11F, 0x8000,
  247.     0xE5C7, 0x8000,
  248.     0xEDF1, 0x8000,
  249.     0xF3FF, 0x8000,
  250.     0xFFFF, 0x8000,
  251.     0x8000, 0x0000,
  252.  
  253.     /* Selected */
  254.     0xFFFF, 0xC000,
  255.     0xFFFF, 0x8000,
  256.     0xFFFF, 0x8000,
  257.     0xFFFF, 0x8000,
  258.     0xFFFF, 0x8000,
  259.     0xFFFF, 0x8000,
  260.     0xFFFF, 0x8000,
  261.     0xFFFF, 0x8000,
  262.     0xFFFF, 0x8000,
  263.     0xFFFF, 0x8000,
  264.     0xFFFF, 0x8000,
  265.     0xFFFF, 0x8000,
  266.     0x8000, 0x0000,
  267.  
  268.     0x0000, 0x0000,
  269.     0x7FFF, 0xC000,
  270.     0x73FF, 0xC000,
  271.     0x6DF1, 0xC000,
  272.     0x65C7, 0xC000,
  273.     0x711F, 0xC000,
  274.     0x7C7F, 0xC000,
  275.     0x711F, 0xC000,
  276.     0x65C7, 0xC000,
  277.     0x6DF1, 0xC000,
  278.     0x73FF, 0xC000,
  279.     0x7FFF, 0xC000,
  280.     0x7FFF, 0xC000
  281. };
  282.  
  283. UWORD ClipImData[14] = {
  284.     /* BitPlane 0 */
  285.     0xFFFF,
  286.     0xFFFF,
  287.     0xE7FF,
  288.     0xDBE3,
  289.     0xCB8F,
  290.     0xE23F,
  291.     0xF8FF,
  292.     0xE23F,
  293.     0xCB8F,
  294.     0xDBE3,
  295.     0xE7FF,
  296.     0xFFFF,
  297.     0xFFFF,
  298.     0xFFFF
  299. };
  300. #endif SNAPGFX
  301.  
  302. VOID CloseStuff()
  303. {
  304.     SafeRestore();
  305.     if (SnapRsrc) {
  306.         KILLLIST(&SnapRsrc->CachedWindows, struct CacheWindow);
  307.         if (SnapRsrc->AlternateFont) {
  308.             CloseFont(SnapRsrc->AlternateFont);
  309.         }
  310.     }
  311. #ifdef SNAPGFX
  312.     if (InactiveDiskImage.ImageData) {
  313.         FreeMem(InactiveDiskImage.ImageData,
  314.                 Kick36 ? sizeof(DiskImData36) : sizeof(DiskImData));
  315.     }
  316.     if (InactiveClipImage.ImageData) {
  317.         FreeMem(InactiveClipImage.ImageData,
  318.                 Kick36 ? sizeof(ClipImData36) : sizeof(ClipImData));
  319.     }
  320. #endif SNAPGFX
  321.     if (TempRaster)             FreeRaster(TempRaster, 16L, CHEIGHT);
  322.     if (CharData)               FreeRaster(CharData, 16L, 256L * CHEIGHT);
  323.     if (inputRequestBlock) {
  324.         if (inputRequestBlock->io_Device) {
  325.             inputRequestBlock->io_Command = IND_REMHANDLER;  /* Remove handler */
  326.             inputRequestBlock->io_Data    = (APTR)&handlerStuff;
  327.             DoIO((struct IORequest *)inputRequestBlock);
  328.             CloseDevice((struct IORequest *)inputRequestBlock);
  329.         }
  330.         DeleteExtIO((struct IORequest *)inputRequestBlock);
  331.     }
  332.     if (inputDevPort)           DeletePort(inputDevPort);
  333.     if (TimerPort) {
  334.         DeletePort(TimerPort);
  335.         CloseDevice((struct IORequest *)&MyTR);
  336.     }
  337.     if (ConIOR) {
  338.         CloseDevice((struct IORequest *)ConIOR);
  339.         DeleteExtIO((struct IORequest *)ConIOR);
  340.     }
  341.     if (ConPort)                DeletePort(ConPort);
  342.     if (ClipReq) {
  343.         if (ClipReq->io_Device) {
  344.             CloseDevice((struct IORequest *)ClipReq);
  345.         }
  346.         DeleteExtIO((struct IORequest *)ClipReq);
  347.     }
  348.     if (ClipPort)               DeletePort(ClipPort);
  349.     if (startsignum != -1)      FreeSignal(startsignum);
  350.     if (donesignum != -1)       FreeSignal(donesignum);
  351.     if (cancelsignum != -1)     FreeSignal(cancelsignum);
  352.     if (movesignum != -1)       FreeSignal(movesignum);
  353.     if (insertsignum != -1)     FreeSignal(insertsignum);
  354.     if (clicksignum != -1)      FreeSignal(clicksignum);
  355.     if (initsignum != -1)       FreeSignal(initsignum);
  356.     if (cwsignum != -1)         FreeSignal(cwsignum);
  357.     if (ticksignum != -1)       FreeSignal(ticksignum);
  358.     if (SnapRsrc) {
  359.         RemResource((struct MiscResource *)SnapRsrc);
  360.         Kill(SnapRsrc);
  361.     }
  362. #ifdef SNAPGFX
  363. #ifdef ASLLIB
  364.     if (AslBase && AslNameFR)   FreeFileRequest(AslNameFR);
  365. #endif ASLLIB
  366. #ifdef REQLIB
  367.     if (ReqBase && NameFR)      Delete(NameFR);
  368. #endif REQLIB
  369. #endif SNAPGFX
  370. }
  371.  
  372. VOID CloseLibs()
  373. {
  374. #ifdef SNAPGFX
  375. #ifdef ASLLIB
  376.     if (AslBase)            CloseLibrary(AslBase);
  377. #endif ASLLIB
  378. #ifdef REQLIB
  379.     if (ReqBase)            CloseLibrary((struct Library *)ReqBase);
  380. #endif REQLIB
  381. #endif SNAPGFX
  382.     if (IconBase)           CloseLibrary(IconBase);
  383.     if (DiskfontBase)       CloseLibrary(DiskfontBase);
  384.     if (LayersBase)         CloseLibrary(LayersBase);
  385.     if (IntuitionBase)      CloseLibrary((struct Library *)IntuitionBase);
  386.     if (GfxBase)            CloseLibrary((struct Library *)GfxBase);
  387. }
  388.  
  389. WORD OpenLibs()
  390. {
  391.     /* libraries */
  392.  
  393.     if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0L)))
  394.         return 0;
  395.     if (!(IntuitionBase =
  396.       (struct IntuitionBase *)OpenLibrary("intuition.library", 0L)))
  397.         return 0;
  398.     if (!(LayersBase = OpenLibrary("layers.library", 0L)))
  399.         return 0;
  400.     DiskfontBase = OpenLibrary("diskfont.library", 0L);
  401.     IconBase = OpenLibrary(ICONNAME, 0L);
  402. #ifdef SNAPGFX
  403. #ifdef REQLIB
  404.     ReqBase = (struct ReqBase *)OpenLibrary("req.library", 0L);
  405. #endif REQLIB
  406. #ifdef ASLLIB
  407.     AslBase = OpenLibrary(AslName, 0L);
  408. #endif ASLLIB
  409. #endif
  410.     return 1;
  411. }
  412.  
  413. WORD OpenStuff()
  414. {
  415.     action = noaction;
  416.     state  = waiting;
  417.     inputRequestBlock = NULL;
  418.  
  419. #ifdef SNAPGFX
  420.     Sharedrefs = 0;
  421.     Sharedport = NULL;
  422. #endif SNAPGFX
  423.  
  424.     /* Set up everything we need. */
  425.  
  426. #ifdef SNAPGFX
  427. #ifdef REQLIB
  428.     if (ReqBase) {
  429.         NameFR = Create(ReqFileRequester);
  430.     }
  431. #endif REQLIB
  432. #ifdef ASLLIB
  433.     if (AslBase) {
  434.         struct TagItem FRTags[4];
  435.  
  436.         SetTag(FRTags[0], ASL_Hail, "Save Picture As...");
  437.         SetTag(FRTags[1], ASL_Dir,  "t:");
  438.         SetTag(FRTags[2], ASL_File, "Snap.pic");
  439.         SetTag(FRTags[3], TAG_END,  NULL);
  440.         AslNameFR = AllocAslRequest(ASL_FileRequest, FRTags);
  441.     }
  442. #endif ASLLIB
  443. #endif SNAPGFX
  444.  
  445.     /* signals */
  446.  
  447.     if ((startsignum = AllocSignal(-1L)) == -1L)
  448.         return 0;
  449.     if ((insertsignum = AllocSignal(-1L)) == -1L)
  450.         return 0;
  451.     if ((cancelsignum = AllocSignal(-1L)) == -1L)
  452.         return 0;
  453.     if ((donesignum = AllocSignal(-1L)) == -1L)
  454.         return 0;
  455.     if ((movesignum = AllocSignal(-1L)) == -1L)
  456.         return 0;
  457.     if ((clicksignum = AllocSignal(-1L)) == -1L)
  458.         return 0;
  459.     if ((initsignum = AllocSignal(-1L)) == -1L)
  460.         return 0;
  461.     if ((cwsignum = AllocSignal(-1L)) == -1L)
  462.         return 0;
  463.     if ((ticksignum = AllocSignal(-1L)) == -1L)
  464.         return 0;
  465.     MyTask = FindTask(NULL);                  /* Find myself to Signal me.  */
  466.     startsignal  = 1L << startsignum;         /* No good to use bit numbers */
  467.     insertsignal = 1L << insertsignum;
  468.     cancelsignal = 1L << cancelsignum;
  469.     donesignal   = 1L << donesignum;
  470.     movesignal   = 1L << movesignum;
  471.     clicksignal  = 1L << clicksignum;
  472.     initsignal   = 1L << initsignum;
  473.     cwsignal     = 1L << cwsignum;
  474.     ticksignal   = 1L << ticksignum;
  475.  
  476.     /* clipboard device */
  477.  
  478.     if (!(ClipPort = CreatePort(0L, 0L)))
  479.         return 0;
  480.     if (!(ClipReq = (struct IOClipReq *)CreateExtIO(ClipPort, (LONG)sizeof(*ClipReq))))
  481.         return 0;
  482.     if (OpenDevice("clipboard.device", 0L, (struct IORequest *)ClipReq, 0L))
  483.         return 0;
  484.     ClipReq->io_ClipID = 0L;
  485.  
  486.     /* console device */
  487.  
  488.     if (!(ConPort = CreatePort(0L, 0L)))
  489.         return 0;
  490.     if (!(ConIOR = (struct IOStdReq *)CreateExtIO(ConPort, (LONG)sizeof(struct IOStdReq))))
  491.         return 0;
  492.     if (OpenDevice("console.device", -1L, (struct IORequest *)ConIOR, 0L))
  493.         return 0;
  494.  
  495.     /* timer device */
  496.     if (!(TimerPort = CreatePort(NULL, 0L)))
  497.         return 0;
  498.     timersignal = 1L << TimerPort->mp_SigBit;
  499.     if (OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest *)&MyTR, 0))
  500.         return 0;
  501.     MyTR.tr_node.io_Message.mn_ReplyPort = TimerPort;
  502.     MyTR.tr_node.io_Error = 0;
  503.  
  504.     /* input device */
  505.  
  506.     if (!(inputDevPort = CreatePort(0L, 0L)))
  507.         return 0;
  508.     if (!(inputRequestBlock = (struct IOStdReq *)CreateExtIO(inputDevPort, (LONG)sizeof(struct IOStdReq))))
  509.         return 0;
  510.     if (OpenDevice("input.device", 0L, (struct IORequest *)inputRequestBlock, 0L))
  511.         return 0;
  512.  
  513.     /* input handler */
  514.  
  515.     handlerStuff.is_Data = (APTR)0x534E4150; /* Set up for installation of */
  516.     handlerStuff.is_Code = myhandler;        /* myhandler.                 */
  517.     handlerStuff.is_Node.ln_Pri = SnapRsrc->Priority;
  518.                                              /* Ahead of intuition, please */
  519.     handlerStuff.is_Node.ln_Name = "Snap Input Handler";
  520.  
  521.     inputRequestBlock->io_Command = IND_ADDHANDLER;
  522.     inputRequestBlock->io_Data    = (APTR)&handlerStuff;
  523.  
  524.     DoIO((struct IORequest *)inputRequestBlock);  /* Add me. */
  525.  
  526.  
  527.     /* Aligned font bitmap to use when matching */
  528.  
  529.     if (!(CharData = AllocRaster(16L, 256L * CHEIGHT))) {
  530.         return 0;
  531.     }
  532.  
  533.     /* temporary raster */
  534.  
  535.     if (!(TempRaster = AllocRaster(16L, CHEIGHT)))
  536.         return 0;
  537.     InitRastPort(&TempRp);                   /* Init RastPort used for */
  538.     InitBitMap(&TempBM, 1L, 16L, CHEIGHT);   /* Locating position of   */
  539.     TempBM.Planes[0] = TempRaster;           /* first character.       */
  540.     TempRp.BitMap = &TempBM;
  541.  
  542. #ifdef SNAPGFX
  543.     {
  544.         WORD i;
  545.         UWORD *DiskImageData;
  546.         UWORD *ClipImageData;
  547.         LONG DiskImageSize;
  548.         LONG ClipImageSize;
  549.  
  550.         if (Kick36) {
  551.             ActiveDiskImage = SelDiskImage = InactiveDiskImage;
  552.             ActiveClipImage = SelClipImage = InactiveClipImage;
  553.             DiskImageData = DiskImData36;
  554.             ClipImageData = ClipImData36;
  555.             DiskImageSize = sizeof(DiskImData36);
  556.             ClipImageSize = sizeof(ClipImData36);
  557.             DiskGad.Flags |= GADGHIMAGE;
  558.             ClipGad.Flags |= GADGHIMAGE;
  559.         } else {
  560.             InactiveDiskImage = SelDiskImage = ActiveDiskImage;
  561.             InactiveClipImage = SelClipImage = ActiveClipImage;
  562.             DiskImageData = DiskImData;
  563.             ClipImageData = ClipImData;
  564.             DiskImageSize = sizeof(DiskImData);
  565.             ClipImageSize = sizeof(ClipImData);
  566.             DiskGad.Flags |= GADGHCOMP;
  567.             ClipGad.Flags |= GADGHCOMP;
  568.         }
  569.         if (!(InactiveDiskImage.ImageData = AllocMem(DiskImageSize, MEMF_CHIP))) {
  570.             return 0;
  571.         }
  572.         ActiveDiskImage.ImageData = &InactiveDiskImage.ImageData[Kick36 ? 48 : 0];
  573.         SelDiskImage.ImageData    = &InactiveDiskImage.ImageData[Kick36 ? 96 : 0];
  574.         for (i = 0; i < (DiskImageSize / sizeof(UWORD)); i++) {
  575.             InactiveDiskImage.ImageData[i] = DiskImageData[i];
  576.         }
  577.         if (!(InactiveClipImage.ImageData = AllocMem(ClipImageSize, MEMF_CHIP))) {
  578.             return 0;
  579.         }
  580.         ActiveClipImage.ImageData = &InactiveClipImage.ImageData[Kick36 ? 52 : 0];
  581.         SelClipImage.ImageData    = &InactiveClipImage.ImageData[Kick36 ? 104 : 0];
  582.         for (i = 0; i < (ClipImageSize / sizeof(UWORD)); i++) {
  583.             InactiveClipImage.ImageData[i] = ClipImageData[i];
  584.         }
  585.     }
  586. #endif SNAPGFX
  587.  
  588.     return 1;
  589. }
  590.